package com.mt.api.modules.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mt.api.modules.domain.AppBossBrand;
import com.mt.api.modules.manager.IBossBrandManager;
import com.mt.api.modules.mapper.AppBossBrandMapper;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: plover
 * @Date: 2022-01-02
 * @Description:
 */
@Component
public class BossBrandManagerImpl extends ServiceImpl<AppBossBrandMapper, AppBossBrand> implements IBossBrandManager {

    @Override
    public AppBossBrand getBossBrandByBossId(Integer bossId) {
        LambdaQueryWrapper<AppBossBrand> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(AppBossBrand::getBossId, bossId)
                .last("limit 1");
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public List<AppBossBrand> getListByBrandId() {
        LambdaQueryWrapper<AppBossBrand> wrapper = Wrappers.lambdaQuery();
        return baseMapper.selectList(wrapper);
    }

}
